package cn.seaboot.admin.user.authority;

import cn.seaboot.admin.user.bean.User;
import cn.seaboot.admin.user.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 强制：任何返回前端的用户信息，密码必须置空
 *
 * @author Mr.css on 2018/7/18.
 */
@Controller
@RequestMapping("authority/user")
@Tag(name = "用户 [t_sys_user] 管理")
public class UserAuthorityCtrl {

    @Resource
    private UserService userService;

    /**
     * 查询全量用户
     *
     * @param params 参数
     * @return list
     */
    @ResponseBody
    @Operation(description = "用户 [t_sys_user] 查询机构用户")
    @RequestMapping(value = "fully", method = RequestMethod.GET)
    public List<User> queryFully(@RequestParam Map<String, Object> params) {
        return userService.queryFully(params);
    }

    /**
     * 查询列表
     *
     * @return list
     */
    @ResponseBody
    @Operation(description = "用户 [t_sys_user] 查询直接上级")
    @RequestMapping(value = "above", method = RequestMethod.GET)
    public List<User> queryAbove() {
        return userService.queryAbove();
    }

    /**
     * 查询列表
     *
     * @return list
     */
    @ResponseBody
    @Operation(description = "用户 [t_sys_user] 查询下属（包含同级）")
    @RequestMapping(value = "horizon", method = RequestMethod.GET)
    public List<User> queryHorizon() {
        return userService.queryHorizon();
    }

    /**
     * 查询列表
     *
     * @return list
     */
    @ResponseBody
    @Operation(description = "用户 [t_sys_user] 查询下属")
    @RequestMapping(value = "below", method = RequestMethod.GET)
    public List<User> queryBelow() {
        return userService.queryBelow();
    }
}
